﻿namespace Comdiv.QWeb.Security {
	public class stubFormAuthenticationProvider : IFormAuthenticationProvider {
		#region IFormAuthenticationProvider Members

		public bool IsAuthenticated(string name, string password, QWebContext context) {
			var key = name + ":" + password;
			if (null == context) return false;
			if (key != "admin:admin" && key != "user:user") return false;
			if (context.NativeASPContext == null) return false;
			if (context.NativeASPContext.Request.UserHostAddress == "127.0.0.1") return true; //IPv4
			if (context.NativeASPContext.Request.UserHostAddress == "::1") return true; //IPv6
			return false;
		}

		#endregion
	}
}